use std::rc::Rc;
/// 暴露给外部的接口
pub struct UserPort {
    user_repository: Rc<Box<dyn crate::domain::user::repository::UserRepository>>,
}
impl UserPort {
    pub fn new(user_repository: Box<dyn crate::domain::user::repository::UserRepository>) -> Self {
        Self {
            user_repository: Rc::new(user_repository),
        }
    }
    pub fn update_user(&self, user_dto: UserDTO) -> Result<(), String> {
        let user = crate::domain::user::entity::User {
            id: user_dto.id.clone(),
            name: user_dto.name.clone(),
            email: user_dto.email.clone(),
            address: crate::domain::user::vo::Address {
                street: user_dto.street.clone(),
                city: user_dto.city.clone(),
                state: user_dto.state.clone(),
            },
        };
        let mut user_action = crate::usecase::user::UserAction::new(self.user_repository.clone());
        user_action.update_info(user)
    }
}
pub struct UserDTO {
    pub id: String,
    pub name: String,
    pub email: String,
    pub street: String,
    pub city: String,
    pub state: String,
}
